
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2466. -- [中山市选2009]树 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2466: [中山市选2009]树</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>42&nbsp;&nbsp;<span class=green>Solved: </span>14<br>[<a href='submitpage.php?id=2466'>Submit</a>][<a href='problemstatus.php?id=2466'>Status</a>][<a href='bbs.php?id=2466'>Discuss</a>]</center><h2>Description</h2><div class=content><p>&nbsp;图论中的树为一个无环的无向图。给定一棵树，每个节点有一盏指示灯和一个按钮。如果节点的按扭被按了，那么该节点的灯会从熄灭变为点亮（当按之前是熄灭的），或者从点亮到熄灭（当按之前是点亮的）。并且该节点的直接邻居也发生同样的变化。<br />
&nbsp;开始的时候，所有的指示灯都是熄灭的。请编程计算最少要按多少次按钮，才能让所有节点的指示灯变为点亮状态。<br />
</p></div><h2>Input</h2><div class=content><p>&nbsp;输入文件有多组数据。<br />
&nbsp;输入第一行包含一个整数n，表示树的节点数目。每个节点的编号从1到n。 <br />
&nbsp;输入接下来的n &ndash; 1行，每一行包含两个整数x，y，表示节点x和y之间有一条无向边。<br />
&nbsp;当输入n为0时，表示输入结束。</p></div><h2>Output</h2><div class=content><div style="text-indent: 21.75pt">对于每组数据，输出最少要按多少次按钮，才能让所有节点的指示灯变为点亮状态。每一组数据独占一行。</div></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>3<br />
1 2<br />
1 3<br />
0<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>1</span></div><h2>HINT</h2>
			<div class=content><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt"><font size="3"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于</span><span lang="EN-US"><font face="Times New Roman">100%</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的数据，满足</span><span lang="EN-US"><font face="Times New Roman">1 &lt;= n &lt;=100</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span></font></p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search='></a></p></div><center>[<a href='submitpage.php?id=2466'>Submit</a>][<a href='problemstatus.php?id=2466'>Status</a>][<a href='bbs.php?id=2466'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
